package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
public class ProductType extends BaseDomain{
    public static final Integer STATE_NOMAL = 0; //正常
    public static final Integer STATE_DISABLE = 1; //禁用
    public static final Integer STATE_COMMEND = 2; //推荐

    private String name;//商品名称
    private Integer state = STATE_NOMAL;
    private String coverImage;//商品封面

    public String getStateName(){
        String msg = "正常";
        if(state == STATE_DISABLE){
            msg = "禁用";
        }else if(state == STATE_COMMEND){
            msg = "推荐";
        }
        return msg;
    }

    public String getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("coverImage",coverImage);
        map.put("state",state);
        return JSONUtil.toJSONString(map);
    }

}